<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" type="text/css" href="/static/plugin/easyUI/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="/static/plugin/easyUI/themes/icon.css">
    <script type="text/javascript" src="/static/plugin/easyUI/jquery.min.js"></script>
    <script type="text/javascript" src="/static/plugin/easyUI/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="/static/plugin/easyUI/locale/easyui-lang-zh_CN.js"></script>
    <script>
        $(function () {
            $("#permission_datagrid").datagrid({
                url:"/permission/query.do",
                fit:true,
                fitColumns:true,
                columns:[[
                    {field:"id",title:"编码",width:100},
                    {field:"name",title:"名称",width:100},
                    {field:"resources",title:"表达式",width:100}
                ]],
                pagination:true,
                singleSelect:true,
                toolbar:"#permission_datagrid_tb"
            });

            $("#reload").linkbutton("select",function () {
                $.messager.confirm('信息', '加载权限需要耗费较长时间,确定需要重新加载吗?', function(r){
                    if (r){
                        //发送ajax请求
                        $.get("/permission/reload.do", function (data) {
                            if (data.success) {
                                $.messager.alert('温馨提示', '加载成功', 'info', function () {
                                    //刷新界面
                                    location.reload();
                                })
                            } else {
                                $.messager.alert('温馨提示', '加载失败', 'error');
                                location.reload();
                            }
                        })
                    }
                });
            });
        });
    </script>
</head>
<body>
    <%--角色列表界面--%>
    <table id="permission_datagrid"></table>
    <%--角色列表界面顶部的工具栏--%>
    <div id="permission_datagrid_tb">
        <a class="easyui-linkbutton" id="reload" data-options="iconCls:'icon-reload', plain:true">加载权限</a>
        <a class="easyui-linkbutton" onclick="remove()" data-options="iconCls:'icon-edit',plain:true">删除</a>
    </div>
</body>
</html>